﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using BALayer;

namespace PGBT
{
    public partial class DanhMucNhapHang : Form
    {
        private GiaoDich db = null;
        private DataSet dsNhap = null;

        public DanhMucNhapHang()
        {
            InitializeComponent();
        }
        private void DanhMucNhapHang_Load(object sender, EventArgs e)
        {
            db = new GiaoDich();
            dsNhap = db.DanhSachNhapHang();

            cbMaNhapHang.DataSource = dsNhap.Tables[0];
            cbMaNhapHang.DisplayMember = "manhaphang";
        }

        private void cbTenNCC_SelectedIndexChanged(object sender, EventArgs e)
        {
            txtTenNCC.Text = dsNhap.Tables[0].Rows[cbMaNhapHang.SelectedIndex].ItemArray[3].ToString();
            txtNgayNhap.Text = dsNhap.Tables[0].Rows[cbMaNhapHang.SelectedIndex].ItemArray[4].ToString();

            int manhaphang = Convert.ToInt32(dsNhap.Tables[0].Rows[cbMaNhapHang.SelectedIndex].ItemArray[0].ToString());
            dgvNhapHang.DataSource = db.ChiTietNhapHang(manhaphang).Tables[0];
        }

    }
}
